package com.neuedu.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.neuedu.dao.GoodsDao;
import com.neuedu.model.Goods;
import com.neuedu.service.GoodsService;

//配置一个spring的服务，把业务实现类交给spring进行管理，由spring完成依赖注入
@Service
public class GoodsServiceImpl implements GoodsService {

	//织入-依赖注入
	@Autowired
	private GoodsDao GoodsDao;	
	public void setGoodsDao(GoodsDao goodsDao) {
			this.GoodsDao = goodsDao;
		}

	@Override
	public int countGoods() {
		return GoodsDao.countGoods();
	}

	@Override
	public List<Goods> findAll(Map<String, Object> map) {
		return GoodsDao.findAll(map);
	}

	@Override
	public int addGoods(Goods g) {
		return GoodsDao.addGoods(g);
	}

	@Override
	public int updateGoods(Goods g) {
		return GoodsDao.updateGoods(g);
	}

	@Override
	public int deleteGoods(int id) {
		return GoodsDao.deleteGoods(id);
	}

}
